package marco.android.CouchControl;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import marco.android.CouchControl.R;
import android.bluetooth.BluetoothSocket;


public class NetworkIO
{

	private DataOutputStream mOutputStream = null;
	public NetworkIO(ByteArrayOutputStream byteStream)
	{
		mOutputStream = new DataOutputStream(byteStream);
    }
	
	public void EventToByteArray(Event e)
	{
		try
		{
			mOutputStream.writeByte(e.Source);
			mOutputStream.writeInt(e.KeyCode);
			mOutputStream.writeInt(e.KeyEvent);
			mOutputStream.writeFloat(e.Dx);
			mOutputStream.writeFloat(e.Dy);

			System.out.println(String.valueOf(e.Dx) + ", " + String.valueOf(e.Dy));
			System.out.println(String.valueOf(e.KeyCode) + ", " + String.valueOf(e.KeyEvent));
		}
		catch(IOException e1)
		{
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	}
}
